Generating the Java Code for WS-AppServer Models |
|
You may choose to generate the Java code for the selected data sources as part of generating Web service operations on Database Metadata or while creating the WS-AppServer package using Database Metadata. If you used neither of these options, you may still generate the Java code from the WS-AppServer Package Editor by following the procedure given here.
In the generated code, each Java class comprises a Base class and an Extension class. These represent tables in the database and contains methods that may be used during transactions. The BaseClass is an extended class of the StateBusObject class, which is an extension on the BusObject class. The BusObject class holds the generic functions such as insert(), update() and delete(). The BaseClass provides the standard generated get-functions (query). The Extension class is used to customize behavior and add custom methods and properties.
Note: WS-AppServer generates Java code based on the model elements inside the WS-AppServer package. Therefore, the model elements such as model mapped name, package name, model attribute mapped names, and method parameter names should inline with the Java identifier naming convention.
- Double-click the <WS-AppServer Package> from either of the following locations:
- Workspace Documents (My Recent Documents) window.
- Workspace Documents (Explorer) > <solution> > <project>. The WS-AppServer Package window appears, displaying the data models and their corresponding attributes, methods, and relations.
- On the WS-AppServer Package toolbar, click . The Generate Java Code on WS-AppServer Models dialog box appears.
- Select classes as per the following options.
Option Description Auto select related classes Used to select the classes that have relations/dependency Overwrite Extension Classes This option is cleared by default. When it is selected, all the extension classes will be overwritten. When it is cleared, the existing extension classes will not be overwritten.The Extension Classes for newly added WS-AppServer classes will still be generated.
Note: If a WS-AppServer class for which the extension class was previously generated is modified, you must select this check box before generating the code in order to reflect the change. The classes are overwritten; therefore, the custom logic in the class will be lost. If required, you must keep a copy of the original code outside the CWS environment.Filter Displays specific results (classes) depending upon the name or initials entered in the field. Used to narrow down search results Java Archive Source Enables selection of a specific Java Archive Source where you can store the generated Java code. Click to browse and select the WS-AppServer Java Archive Source available in the project. Class name Lists all the classes available in the WS-AppServer Package. Select the topmost check box to select all the classes or select each check box to select individual classes. You can navigate through the list of classes using the navigation buttons on the interface.
Note: If you have selected the Auto select related classes option, all the related classes will also get selected when you select a class. - Click Generate.
The Java code is generated and is added to the project at the specified location within a folder Java Archive <WS-AppServer package name>.After you complete this task:
Publish the generated Java code so that the code is compiled and the Java classes are packaged in a .JAR file. By default, the .JAR file is stored at<Process_Platform_Installation_Directory>\<instance name>\bsf\runtime\deploy
and this location is added to the classpath of the WS-AppServer Service. The path details are mentioned against the wsappserver.deploy.folder property in the wsapps.properties file located at<Process_Platform_Installation_Directory>\<instance name>\components\wsappserver\config
. An Administrator can modify the path, if required. For example, in Windows, wsappserver.deploy.folder=C:\PROGRA~1\Cordys\DEFAUL~1\bsf\runtime\deploy
and in Linux, wsappserver.deploy.folder= <Process_Platform_Installation_directory>\bsf\runtime\deploy
. While changing the path, keep the folder separators as they are in the default path.